package com.yxy.ms.manager.common;

/**
 * @author
 * @description: 类功能描述
 * @date 2019/6/12
 * @Version V1.0
 */
public class Common {

    /**
     * 返回400 一般使用在开头，初始化Results
     *
     * @return results
     */
    public static Results results400() {
        Results results = results400(ResultsDictionary.ErrMsg.ERR_400);
        return results;
    }

    /**
     * 返回400 一般使用在catch里面
     *
     * @param errMsg
     *            自定义异常信息
     * @return results
     */
    public static Results results400(String errMsg) {
        Results results = new Results(ResultsDictionary.Flag.F, ResultsDictionary.ErrCode.CODE_400, errMsg);
        return results;
    }

    /**
     * 返回403 系统异常 一般使用在catch里面
     *
     * @return results
     */
    public static Results results403() {
        Results results = results403(ResultsDictionary.ErrMsg.ERR_403);
        return results;
    }

    /**
     * 返回403 系统异常 一般使用在catch里面
     *
     * @param errMsg
     *            自定义异常信息
     * @return results
     */
    public static Results results403(String errMsg) {
        Results results = new Results(ResultsDictionary.Flag.F, ResultsDictionary.ErrCode.CODE_403, errMsg);
        return results;
    }

    /**
     * 成功返回200
     *
     * @return results
     */
    public static Results results200() {
        Results results =
            new Results(ResultsDictionary.Flag.T, ResultsDictionary.ErrCode.CODE_200, ResultsDictionary.ErrMsg.ERR_200);
        return results;
    }

    public static Results results200(Object obj) {
        Results results = new Results(ResultsDictionary.ErrCode.CODE_200, ResultsDictionary.ErrMsg.ERR_200,
            ResultsDictionary.Flag.T, obj);
        return results;
    }

}
